package com.java.service.impl;

import com.github.pagehelper.PageHelper;
import com.java.mapper.PlayerMapper;
import com.java.service.PlayerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class PlayerServiceImpl implements PlayerService {
    @Autowired
    private PlayerMapper playerMapper;

    @Override
    public List<Map<String,Object>> findAllPlayer(int pageNum,int pageSize){
        //使用PageHelper分页
        PageHelper.startPage(pageNum,pageSize);
        return playerMapper.selectAllPlayer();
    }

    /**
     * 参赛选手注册，插入数据
     */
    public int addPlayer(Map<String,Object> map){
        return playerMapper.insertPlayer(map);
    }

    /**
     * 参赛选手查询本队信息，以队长手机号查询
     */
    public Map<String,Object> findOnePlayer(Map<String,Object> map){
        return playerMapper.selectOnePlayer(map);
    }

    /**class_1
     * 参赛选手修改数据
     */
    public int updatePlayer(Map<String,Object> map){
        return playerMapper.updateTeamInfo(map);
    }
}
